/**
 * 
 */
package ase.eleitweg.common;

import java.util.Date;
import java.io.*;
/**
 * @author Aigner
 *
 */
public class Run implements Serializable {
	
	public static long serialVersionUID = 1L;

	private int id;
	private Workflow wf;
	private User user;
	private Node node;
	private Date date;
	private boolean accepted;
	private String desc;

	public Run(Workflow wf, User user, Node node, Date date, boolean accepted) {
		super();
		this.wf = wf;
		this.user = user;
		this.node = node;
		this.date = date;
		this.accepted = accepted;
	}
	
	public Run(Workflow wf, User user, Node node, Date date, boolean accepted, int runid) {
		super();
		this.wf = wf;
		this.user = user;
		this.node = node;
		this.date = date;
		this.id = runid;
		this.accepted = accepted;
	}
	
	public Run(Workflow wf, User user, Node node, Date date, boolean accepted, int runid,
			   String desc, String string) {
		super();
		this.wf = wf;
		this.user = user;
		this.node = node;
		this.date = date;
		this.id = runid;
		this.accepted = accepted;
		this.desc = desc;
	}

	public boolean isAccepted() {
		return accepted;
	}

	public void setAccepted(boolean accepted) {
		this.accepted = accepted;
	}

	public Workflow getWf() {
		return wf;
	}

	public void setWf(Workflow wf) {
		this.wf = wf;
	}

	public User getUser() {
		return user;
	}

	public void setUser(User user) {
		this.user = user;
	}

	public Node getNode() {
		return node;
	}

	public void setNode(Node node) {
		this.node = node;
	}

	public Date getDate() {
		return date;
	}

	public void setDate(Date date) {
		this.date = date;
	}
	
	public boolean isFinished() {
		return node.isEnd();
	}

	public int getId() {
		return id;
	}

	public void setId(int runid) {
		this.id = runid;
	}
	
	public String getName() {
		return wf.getName() + "-" + id;
	}

	public String getDesc() {
		return desc;
	}

	public void setDesc(String desc) {
		this.desc = desc;
	}
}
